using System;
using System.Threading.Tasks;
using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    /// <summary>
    /// 系统提醒仓储接口
    /// </summary>
    public interface ISystemReminderRepository : IRepository<SystemReminder>
    {
        /// <summary>
        /// 根据用户ID获取提醒列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>提醒列表</returns>
        Task<IEnumerable<SystemReminder>> GetByUserIdAsync(Guid userId);

        /// <summary>
        /// 根据提醒类型获取提醒列表
        /// </summary>
        /// <param name="reminderType">提醒类型</param>
        /// <returns>提醒列表</returns>
        Task<IEnumerable<SystemReminder>> GetByReminderTypeAsync(string reminderType);

        /// <summary>
        /// 根据提醒状态获取提醒列表
        /// </summary>
        /// <param name="status">提醒状态</param>
        /// <returns>提醒列表</returns>
        Task<IEnumerable<SystemReminder>> GetByStatusAsync(string status);

        /// <summary>
        /// 获取用户启用中的提醒列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>提醒列表</returns>
        Task<IEnumerable<SystemReminder>> GetActiveRemindersAsync(Guid userId);

        /// <summary>
        /// 获取需要执行的提醒列表
        /// </summary>
        /// <returns>提醒列表</returns>
        Task<IEnumerable<SystemReminder>> GetExecutableRemindersAsync();

        /// <summary>
        /// 获取提醒列表（分页）
        /// </summary>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="userId">用户ID</param>
        /// <param name="reminderType">提醒类型</param>
        /// <param name="status">提醒状态</param>
        /// <returns>提醒列表</returns>
        Task<(IEnumerable<SystemReminder> Items, int TotalCount)> GetRemindersPagedAsync(
            int pageIndex, 
            int pageSize, 
            Guid? userId = null, 
            string reminderType = null, 
            string status = null);

        /// <summary>
        /// 启用提醒
        /// </summary>
        /// <param name="reminderId">提醒ID</param>
        /// <param name="operatorId">操作人ID</param>
        /// <returns>是否成功</returns>
        Task<bool> EnableReminderAsync(Guid reminderId, Guid operatorId);

        /// <summary>
        /// 禁用提醒
        /// </summary>
        /// <param name="reminderId">提醒ID</param>
        /// <param name="operatorId">操作人ID</param>
        /// <returns>是否成功</returns>
        Task<bool> DisableReminderAsync(Guid reminderId, Guid operatorId);

        /// <summary>
        /// 完成提醒
        /// </summary>
        /// <param name="reminderId">提醒ID</param>
        /// <param name="operatorId">操作人ID</param>
        /// <returns>是否成功</returns>
        Task<bool> CompleteReminderAsync(Guid reminderId, Guid operatorId);

        /// <summary>
        /// 更新下次提醒时间
        /// </summary>
        /// <param name="reminderId">提醒ID</param>
        /// <param name="nextTime">下次提醒时间</param>
        /// <returns>是否成功</returns>
        Task<bool> UpdateNextTimeAsync(Guid reminderId, DateTime nextTime);
    }
}